#pragma once

#include <unordered_map>
#include "../share/user_define.h"
#include "../../3rd/libjson/json.h"

/*
"id": 15,
"consume": 6500
*/

struct UpgradeEquipmentConsume
{
	uint32_t mId;
	uint32_t mConsume;

	UpgradeEquipmentConsume()
	{
		Clear();
	}

	void Clear(void)
	{
		mId = 0;
	}
};

class UpgradeEquipmentConsumeCacheData
{
public:

	static void CreateInstance(void);
	static UpgradeEquipmentConsumeCacheData* GetInstance(void);

	~UpgradeEquipmentConsumeCacheData(void);

public:

	bool Initialization(void);

	bool Reload(void);

	UpgradeEquipmentConsume* GetData(uint32_t id);

	bool GetDataJsonString(uint32_t id, Json::Value& _jm);

	uint32_t GetDataCount(void);

private:
	UpgradeEquipmentConsumeCacheData(void);

	void Clear(void);

	void AddData(uint32_t id, Json::Value& jm);


private:

	static UpgradeEquipmentConsumeCacheData* mInstance;

	std::unordered_map<uint32_t, UpgradeEquipmentConsume*> m_mapCacheData;
	uint32_t m_maxCount;

};